<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        div {
            width: 200px;
            height: 200px;
            background-color: pink;
            transition: all 1s;
            position: relative;
            top: 0;
            left: 0;
        }
    </style>
</head>

<body>
    <button>点击</button>
    <div></div>
    <script>
        // 2. 页面上有一个元素，  点击按钮。元素从左到右移动

        const div = document.getElementsByTagName('div')[0]
        const btn = document.getElementsByTagName('button')[0]

        btn.onclick = () => {
            div.style.left = '1000px'
        }

    </script>
</body>

</html>